<template>
  <div id="meeting">
    <el-container>
      <el-header>
        <p>发起会议</p>
      </el-header>
      <el-main>
        <el-form ref="form1" :model="formdata" label-width="80px">
          <el-descriptions title="发起人信息" :column="2" border>
            <el-descriptions-item label="流水号"
              ><el-input v-model="formdata.meeting_num" disabled></el-input
            ></el-descriptions-item>
            <el-descriptions-item label="姓名"
              ><el-input v-model="formdata.name" disabled></el-input
            ></el-descriptions-item>
            <el-descriptions-item label="部门"
              ><el-input v-model="formdata.department_name" disabled></el-input
            ></el-descriptions-item>
            <el-descriptions-item label="岗位"
              ><el-input v-model="formdata.post_name" disabled></el-input
            ></el-descriptions-item>
            <el-descriptions-item label="发起时间"
              ><el-input v-model="formdata.meeting_todotime" disabled></el-input
            ></el-descriptions-item>
          </el-descriptions>

          <el-descriptions title="会议信息" :column="2" border>
            <el-descriptions-item label="会议标题"
              ><el-input v-model="formdata.meeting_tit"></el-input
            ></el-descriptions-item>
            <el-descriptions-item label="会议内容"
              ><el-input v-model="formdata.meeting_cont"></el-input
            ></el-descriptions-item>
            <el-descriptions-item label="会议室"
              ><el-select
                v-model="formdata.meeting_room"
                placeholder="选择会议室"
              >
                <el-option label="招待室1" value="1"></el-option>
                <el-option label="招待室1" value="2"></el-option>
                <el-option label="会议室1" value="3"></el-option>
                <el-option label="会议室1" value="4"></el-option>
                <el-option label="会议室1" value="5"></el-option>
                <el-option label="会议室1" value="6"></el-option>
              </el-select>
            </el-descriptions-item>
            <el-descriptions-item label="开始时间">
              <el-date-picker
                v-model="formdata.meeting_startime"
                type="datetime"
                placeholder="选择日期时间"
                value-format="yyyy-MM-dd HH:mm:ss"
                format="yyyy-MM-dd HH:mm:ss"
              >
              </el-date-picker>
            </el-descriptions-item>
            <el-descriptions-item label="参会人数"
              ><el-input v-model="formdata.meeting_pernum"></el-input
            ></el-descriptions-item>
            <el-descriptions-item label="结束时间">
              <el-date-picker
                v-model="formdata.meeting_endtime"
                type="datetime"
                placeholder="选择日期时间"
                value-format="yyyy-MM-dd HH:mm:ss"
                format="yyyy-MM-dd HH:mm:ss"
              >
              </el-date-picker>
            </el-descriptions-item>
          </el-descriptions>
        </el-form>
        <div id="mybut">
          <el-button type="primary" @click="submit()">提交</el-button>
          <el-button type="info" @click="myreturn()">返回</el-button>
        </div>
      </el-main>
    </el-container>
  </div>
</template>
<script>
export default {
  data() {
    return {
      form: {
        name: "0",
      },
      value1: "",
      formdata: {},
    };
  },
  methods: {
    p(s) {
      return s < 10 ? "0" + s : s;
    },
    open3() {
      this.$message({
        message: "填写成功",
        type: "success",
      });
    },
    submit: function () {
      this.$axios({
        url: "/personalcenter/meeting/add",
        method: "post",
        data: {
          mydata: this.formdata,
        },
      }).then((res) => {
        this.open3();
        this.$router.go(-1);
      });
    },
    myreturn: function () {
      this.$router.go(-1);
    },
  },
  mounted: function () {
    // console.log(this.$store.state.data.work_id)
    this.$axios({
      url: "/personalcenter/meeting/addget",
      params: { workid: JSON.parse(sessionStorage.getItem("user")).work_id },
    }).then((res) => {
      const d = new Date();
      const resDate =
        d.getFullYear() +
        "-" +
        this.p(d.getMonth() + 1) +
        "-" +
        this.p(d.getDate());
      const resTime =
        this.p(d.getHours()) +
        ":" +
        this.p(d.getMinutes()) +
        ":" +
        this.p(d.getSeconds());
      this.formdata = res.data.data[0];
      this.formdata.meeting_todotime = resDate + ` ` + resTime;
      this.formdata.meeting_num = res.data.data2;
    });
  },
};
</script>
<style scoped lang='less'>
.el-main {
  padding: 20px 0 !important;
}
#meeting {
  width: 70%;
  margin: 20px auto;
  padding: 30px;
  border-radius: 5px;
}
.el-header {
  color: #666;
  text-align: center;
  line-height: 60px;
  p {
    font-weight: bold;
    font-size: 24px;
  }
}
.el-select {
  width: 100%;
}
#mybut {
  text-align: center;
  margin-top: 20px;
}
.el-date-editor {
  width: 100%;
}
.el-descriptions {
  margin-bottom: 20px !important;
}
</style>